<script setup>
import { ref } from 'vue'
const props = defineProps({
  pic: {
    type: String,
  },
  price: {
    type: Number,
  },
  title: {
    type: String,
  },
  dis: {
    type: Number,
  },
  num: {
    type: Number,
  },
});

</script>

<template>
  <div>
    <dl>
      <dt><img :src=props.pic alt=""></dt>
      <dd>
        <p class="van-multi-ellipsis--l2">{{ props.title }}</p>
        <span>{{ props.num }}人正在学</span>
        <div class="ttt">
         
            <div  class="price" v-if="props.price !==0">
              <span class="np"> ￥{{Math.ceil(props.price * props.dis)  }}</span>
              <span class="rp" v-if="props.dis !==1"> {{ props.price }}</span>
          </div>

            <div class="price" v-else>免费</div>
            <div class="hong" v-if="props.dis!==1">限时优惠</div>
        </div>
      </dd>
    </dl>
  </div>
</template>


<style scoped lang="scss">
$size: 0.45rem;
dl {
  padding: 0.1rem;
  margin-top: 0.4rem;
  width: 9rem;
  height: 2.6rem;
  display: flex;
  justify-content: space-between;
position: relative;
  dt {
    width: 37%;
    // height: 10;
    border-radius: 6%;
    // background-color: orangered;
    img{
      width: 100%;
      height: 100%;
      display: block;
      width: 100%;
      background-color: rgb(103,110 ,224 );
      border-radius: 12px;
    }
  }

  dd {
    width: 58%;
    padding: 0.1rem;
    
    p {
      font-size: $size;
    }
    span {
      font-size: 0.4rem;
      color: gray;
    }

    .ttt {
      display: flex;
      width: 60%;
      // border: 1px solid red;
      align-self: center;
      position: absolute;
      bottom: 0.01rem;
      .price {
        font-size: 0.5rem;
        width: 47%;
      }

      .hong {
        align-self: center;
        width: 40%;
        font-size: 0.4rem;
        color: red;
        border: 1px solid red;
        border-radius: 12px;
        display: flex;
        justify-content: center;
      }
    }

  }
}

.np{
        color: rgb(254, 205, 71);
        margin-right: 0.2rem;
        font-size: 0.5rem;
      }
      .rp{
        color: gray;
        text-decoration: line-through;
        font-size: 0.45rem;
      }
    
</style>
